﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UsersForCustomers_CRUD.aspx.cs" Inherits="FimetContoDeposito.Anagrafiche.UsersForCustomers_CRUD" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <asp:PlaceHolder ID="PlaceHolder1" runat="server"> 
        <%: Scripts.Render("~/bundles/JQuery") %>          
        <%: Scripts.Render("~/bundles/JQueryUI") %>                
        <%: Styles.Render("~/bundles/Formly/css") %>
        <%: Scripts.Render("~/bundles/Formly") %>
    </asp:PlaceHolder>
          
    <script type="text/javascript" lang="javascript" src="../Scripts/Formly/FormlyHelper.js"></script>
    <script type="text/javascript" lang="javascript" src="../Scripts/GrayParrot.Core.js"></script> 
    <script type="text/javascript" lang="javascript" src="../Scripts/GrayParrot.AngularJS.Directives.Fileupload.js"></script> 
    <script type="text/javascript" lang="javascript" src="../Scripts/GrayParrot.AngularJS.Directives.DateTimePicker.js"></script> 
    <script type="text/javascript" lang="javascript" src="../Scripts/GrayParrot.AngularJS.js"></script> 

    <title>Anagrafica Operatori</title>

    <style>
        /*.input-group-addon
        {  
           font-size:10px;
           height:20px;
           width:100%;
           padding:0px;
        }*/

        .col-xs-3
        {
            padding:2px;
        }
        .col-xs-6
        {
            padding:2px;
        }
        .col-xs-10
        {
            padding:1px;
        }
        .col-xs-12
        {
            padding:1px;
        }
        .form-control
        {
            font-size:14px;
            padding:2px;
        }
        .formly-field
        {
            font-size:14px;
            padding:2px;
        }
        body#divFormly
        {
            padding:2px;
        }

        .bootbox {
            left: auto !important;
            width: auto !important;
            margin-left: auto !important;
            background-color: transparent !important;
            border: none !important;
            -webkit-box-shadow: none !important;
            box-shadow: none !important;
            position: relative !important;
            top: 50% !important;
            overflow: visible !important;
            transition: opacity 0.15s linear 0s !important;
        }
    </style>
</head>

<body ng-app="formlyExample" ng-controller="MainCtrl as vm" id="divFormly" name="divFormly">

    <%--<h1>Operatori cliente<br /><hr /></h1>--%>
    <div ng-if="vm.loadingData.$$state.status === 0" style="margin:20px 0;font-size:2em">
        <strong>Loading...</strong>
    </div>
    <div ng-if="vm.loadingData.$$status.state !== 0">
        <form ng-submit="vm.onSubmit()" novalidate id="formlyForm">
            <formly-form model="vm.model" fields="vm.fields" form="vm.form">
            <button type="sumbit" class="btn btn-primary submit-button" ng-disabled="vm.form.$invalid">Salva</button>
            </formly-form>
        </form>
    </div>

</body>

   <script>

       var idToEdit = GetQueryStringParams("id");

       var settings = new FormlySettings();
       settings.container = '#divFormly';
       settings.callbackSuccess = SuccessCallback;

       if (idToEdit == undefined) {
           settings.setLoad(settings.createGetConfig('/api/Customers/LoadFieldsNewCustomerByFimet'));
           settings.setSend(settings.createPostConfig('/api/Customers/NewUserCustomer'));
       } else {
           settings.setLoad(settings.createGetConfig('/api/Customers/LoadFieldsNewCustomerByFimet', { id: idToEdit }));
           settings.setSend(settings.createPostConfig('/api/Customers/EditCustomerOperatorBags'));
       }

       FormlyManager(settings);

       //
       function SuccessCallback(response) {

           ShowResponseMessage(response);

           window.parent.CloseDialog();
       }

   </script>

</html>
